<template>
    <div>
      名称：<input type="text" v-model="name">  价格: <input type="text" v-model="price">  <button @click="add">添加</button>
    </div>
</template>


<script>
export default {
    data(){
        return{
            name:'',
            price:''
        }
    },
    methods:{
        add(){
            let obj = {name:this.name,price:this.price,flag:false}
            this.$emit('add',obj)
            this.name=this.price=''
        }
    }
}
</script>


<style scope>
    ul{
        width: 600px;
        background: orange;
        display: flex;
        justify-content: space-around;
    }
</style>
